<template>
  <div>
    <zfw-form-search :fileds="fileds" @onSearch="onSearch">
      <template #operate>
        <el-button size="small" plain type="primary" icon="el-icon-plus">新增</el-button>
      </template>
    </zfw-form-search>
    <zfw-table row-key="id" :column="column" :onSearch="handleSearch" @selectChange="selectChange" :params="params">
      <template #operate="row">
        <el-button type="primary" size="small">编辑</el-button>
      </template>
    </zfw-table>
  </div>
</template>
<script>
import ZfwFormSearch from "@/components/zfw-common/zfw-form-search/index"
import ZfwTable from "@/components/zfw-common/zfw-table/index"
export default {
  name: "noticeList",
  components: { ZfwFormSearch, ZfwTable },
  data() {
    return {
      params: {},
      column: [
        {
          type: "selection",
          width: "55"
        },
        {
          type: "index",
          width: "50",
          label: "序号"
        },
        {
          prop: "name",
          label: "名称"
        },
        {
          prop: "date",
          label: "时间"
        },
        {
          prop: "address",
          label: "地址"
        },
        {
          prop: "operate",
          label: "操作",
          isSlot: true
        }
      ],
      fileds: [
        {
          key: "name",
          filedType: "Input",
          layout: {
            span: 3
          },
          itemProps: {
            prop: "name"
          }, props: {
            placeholder: "请输入文件标题"
          }
        }, {
          key: "type",
          filedType: "Select",
          layout: { span: 3 },
          itemProps: {
            prop: "type"
          },
          props: {
            options: [{ value: '1', label: "文件" }]
          }
        },
        {
          key: "time",
          filedType: "DatePicker",
          layout: { span: 3 },
          itemProps: {
            prop: "time"
          },
          props: {
            type: 'date'
          }
        },

      ]
    }
  },
  methods: {
    onSearch(params) {
      this.params = { ...params }
      this.handleSearch()
    },
    handleSearch(values) {
      const datas = {
        list: [{
          id: "1",
          date: '2016-05-02',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        }, {
          id: '2',
          date: '2016-05-04',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1517 弄'
        }, {
          id: '3',
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄'
        }, {
          id: "4",
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄'
        }, {
          id: "5",
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄'
        }, {
          id: "6",
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄'
        }],
        total: 6
      }
      return datas
    },
    selectChange(values) {

    }
  }
}
</script>
